package edu.tsinghua.mrpvc.device.mic;


import java.util.Dictionary;
import java.util.Hashtable;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;

import edu.tsinghua.mrpvc.device.MicDevice;
//import edu.tsinghua.mrpvc.simulate.util.SimulateTopic;


public class Activator implements BundleActivator, EventHandler{

//	private MicDeviceImpl mic;
//	private final static String[] RESPONSE_EVENT = {MicDevice.EVENT_TOPIC_ISVALID};
	//private final static String[] SIMULATE_EVENT = {SimulateTopic.MIC_CLOSE, SimulateTopic.MIC_OPEN};
	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
//		mic = new MicDeviceImpl(context);
//		context.registerService(MicDevice.class.getName(), mic, null);
//		
//		Dictionary<String, Object> resProperty = new Hashtable<String, Object>();
//		resProperty.put(EventConstants.EVENT_TOPIC, RESPONSE_EVENT);
//		context.registerService(EventHandler.class.getName(), mic, resProperty);
//		
		//Dictionary<String, Object> simProperty = new Hashtable<String, Object>();
		//simProperty.put(EventConstants.EVENT_TOPIC, SIMULATE_EVENT);
		//context.registerService(EventHandler.class.getName(), this, simProperty);
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
	}

	@Override
	public void handleEvent(Event event) {
		// TODO Auto-generated method stub
		//if(event.getTopic().equals(SimulateTopic.MIC_OPEN)){
		//	mic.openEvent();
		//}
		//else if(event.getTopic().equals(SimulateTopic.MIC_CLOSE)){
		//	mic.closeEvent();
		//}
	}

}
